
package com.ruoyi.buss.report.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.buss.report.domain.ReportMarketPerformanceLsb;
import com.ruoyi.buss.report.service.IReportMarketPerformanceLsbService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 营销任务进度历史记录，每天保存4.1.1Controller
 *
 * @author sxy
 * @date 2021-07-16
 */
@RestController
@RequestMapping("/importReportExce")
public class ImportReportExcelController extends BaseController
{
    @Autowired
    private TokenService tokenService;

    @Autowired
    private IReportMarketPerformanceLsbService reportMarketPerformanceLsbService;

    /**
     * 营销任务进度概括表
     * 营销任务进度表
     */
    @ApiOperation(value = "营销任务进度概括表", notes = "营销任务进度概括表")
    @PreAuthorize(hasPermi = "buss:yxrwjdlsb:exportYxrwjdbService")
    @Log(title = "营销任务进度概括表", businessType = BusinessType.EXPORT)
    @PostMapping("/exportYxrwjdbService")
    public void exportYxrwjdbService(HttpServletResponse response, ReportMarketPerformanceLsb reportMarketPerformanceLsb) throws IOException {
        LoginUser userInfo = tokenService.getLoginUser();

        List<ReportMarketPerformanceLsb> list =
                reportMarketPerformanceLsbService.
                        selectReportMarketPerformanceLsbList(reportMarketPerformanceLsb,userInfo, 4);
        ExcelUtil<ReportMarketPerformanceLsb> util = new ExcelUtil<ReportMarketPerformanceLsb>(ReportMarketPerformanceLsb.class);
        util.exportExcel(response, list, "营销任务进度概括表");
    }


    @ApiOperation(value = "营销任务进度概括表（总行）", notes = "营销任务进度概括表（总行）")
    @PreAuthorize(hasPermi = "buss:yxrwjdlsb:exportTaskUserServiceZh")
    @Log(title = "营销任务进度概括表", businessType = BusinessType.EXPORT)
    @PostMapping("/exportTaskUserServiceZh")
    public void exportTaskUserServiceZh(HttpServletResponse response, ReportMarketPerformanceLsb reportMarketPerformanceLsb) throws IOException {
        LoginUser userInfo = tokenService.getLoginUser();

        List<ReportMarketPerformanceLsb> list =
                reportMarketPerformanceLsbService.
                        selectReportMarketPerformanceLsbList(reportMarketPerformanceLsb,userInfo, 4);
        ExcelUtil<ReportMarketPerformanceLsb> util = new ExcelUtil<ReportMarketPerformanceLsb>(ReportMarketPerformanceLsb.class);
        util.exportExcel(response, list, "营销任务进度概括表");
    }
}

